<?php

use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kzo\base\models\statics\EntityModelStatus;
use kzo\base\widgets\ui\bs4\Alert;

/* @var $model common\models\c2\search\LessonDailySearch */

$regularLangName = \Yii::$app->kzoHelper->getRegularLangName();
$messageName = $model->getMessageName();
?>

<?php
$form = ActiveForm::begin([
'action' => ['edit', 'id' => $model->id],
'options' => [
'id' => $model->getBaseFormName(),
'data-pjax' => true,
]]);
?>

<div class="<?=$model->getPrefixName('form')?> card bg-light mt-2">
    <div class="card-body">

        <?php if (Yii::$app->session->hasFlash($messageName)): ?>
        <?php        if (!$model->hasErrors()) {
            echo Alert::widget([
                'type' => Alert::TYPE_SUCCESS,
                'title' => 'Well Down',
                'icon' => 'fas fa-ok-circle',
                'body' => Yii::$app->session->getFlash($messageName),
                'showSeparator' => true,
                'delay' => 2000
            ]);
        } else {
            echo Alert::widget([
                'type' => Alert::TYPE_WARNING,
                'title' => 'Warning!',
                'icon' => 'fas fa-ok-circle',
                'body' => Yii::$app->session->getFlash($messageName),
                'showSeparator' => true,
            ]);
        }
        ?>
        <?php endif; ?>

        <?php
            echo Form::widget([
            'model' => $model,
            'form' => $form,
            'columns' => 2,
            'attributes' => [
             'lesson_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => $model->getAttributeLabel('lesson_id')]],
 'teacher_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => $model->getAttributeLabel('teacher_id')]],
 'lesson_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\kartik\widgets\DateTimePicker', 'options' => [
                            'options' => ['placeholder' => Yii::t('app.c2', 'Date Time...')], 'pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'autoclose' => true],
                        ], ],
 'lesson_time' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => $model->getAttributeLabel('lesson_time')]],
 'allow_people' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => $model->getAttributeLabel('allow_people')]],
 'remain_num' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => $model->getAttributeLabel('remain_num')]],
 'status' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => EntityModelStatus::getHashMap('id', 'label')],
        ] ]);
        echo Html::submitButton('<i class="fa fa-save"></i> ' . Yii::t('app.c2', 'Save'), ['type' => 'button', 'class' => 'btn btn-primary float-right ml-2']);
        echo Html::a('<i class="fa fa-arrow-left"></i> ' . Yii::t('app.c2', 'Go Back'), ['index'], [ 'data-pjax' => '0', 'class' => 'btn btn-light float-right', 'title' => Yii::t('app.c2', 'Go Back'),]);
        ?>

    </div>
</div>
<?php ActiveForm::end(); ?>
